import messageHandler from '../../handler/messageHandler';

export default class MessageIncomeHandle {
  static async handle({ ctx, data }) {
    const message = await messageHandler.post(
      data.channel,
      ctx.viewer,
      data,
    );
    ctx.logger.info(`${ctx.socket.id} >>> MESSAGE "CHANNEL ${data.channelId}" "USER ${ctx.viewer._id}(${ctx.viewer.username})" ${message.body}`);
  }
}
